package com.ruoyi.common.utils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author anan.
 * @version 1.0
 * @create 2020-11-24 16-05
 */
@Component
public class RoleUtil {
    private static ISysRoleService roleService;

    @Autowired
    private ISysRoleService roleService0;

    @PostConstruct
    private void initRoleUtil(){
        roleService=this.roleService0;
    }

    public static Long getDefaultRoleId(){
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("is_default","Y");
        return roleService.getOne(wrapper).getRoleId();
    }
}
